import { Application } from "egg";
import axios from "axios";

const AXIOS = Symbol("Application#axios");

export default {
  echo(this: Application, msg: string) {
    return `hello${msg}${this.config.name}`;
  },

  get axiosInstance() {
    if (!this[AXIOS]) {
      this[AXIOS] = axios.create({
        baseURL: "https://dog.ceo/",
        timeout: 5000,
      });
    }
    return this[AXIOS];
  },
};
